<?php

namespace App\Support\CustomForm;


class AttributeOpenShopSupport extends AttributeSupport
{
    const INPUT_TYPE_TEXT            = "text";
    const INPUT_TYPE_TEXTAREA        = 'textarea';
    const INPUT_TYPE_SELECT_MULTIPLE = 'select-multiple'; // 下拉 - 多选框
    const INPUT_TYPE_ALBUM_RADIO     = 'albumRadio'; // 相册单选，默认
    const INPUT_TYPE_ALBUM_CHECKBOX  = 'albumCheckbox'; // 相册多选
    const INPUT_TYPE_CAMERA_RADIO    = 'cameraRadio'; // 相机单选
    const INPUT_TYPE_CAMERA_CHECKBOX = 'cameraCheckbox'; // 相机多选
    const INPUT_TYPE_VIDEO_RADIO     = 'videoRadio'; // 视频单选
    const INPUT_TYPE_VIDEO_CHECK_BOX = 'videoCheckbox'; // 视频多选

    protected function __construct(string $inputName, string $inputType, string $inputDesc)
    {
        parent::__construct($inputName, $inputType, $inputDesc);

        if (in_array($inputType, [self::INPUT_TYPE_SELECT, self::INPUT_TYPE_SELECT_MULTIPLE, self::INPUT_DATE, self::INPUT_DATETIME])) {
            $this->setCustomAttribute(['icon', 'arrow-right']);
        }
    }

    public static function setSelectOptions(array $enums): array
    {
        $arr = [];
        foreach ($enums as $k => $v) {
            $arr[] = [
                'text'  => $v,
                'value' => $k
            ];
        }

        return $arr;
    }


    const ALBUM_RADIO         = 'albumRadio';      //相册单选
    const ALBUM_CHECKBOX      = 'albumCheckbox';   //相册单选
    const CAMERA_RADIO        = 'cameraRadio';     //相机多选
    const CAMERA_CHECKBOX     = 'cameraCheckbox';  //相机多选
}
